<template>
	<view class="box_width">
		
		<view class="top_info_box">
			<view class="top_info_img">
				<image src="@/static/touxiang@2x.png" mode="aspectFill"></image>
			</view>
			<view class="info_left_box m_top">
				<view class="title-biaoti2 info_left_height">
					{{name}}
				</view>
				<view class="zhengwen1 info_left_height">
					学号:{{sno}}
				</view>
			</view>
		</view>
		
		<view class="my_con">
			<view class="item_info zhengwen1">
				<image src="../../../static/xueyuan@2x.png"></image>
				<view class="item_label">学&nbsp;&nbsp;&nbsp;院</view>
				<view class="item_value">{{colname}}</view>
			</view>
			
			<view class="item_info zhengwen1">
				<image src="../../../static/zhuanye@2x.png"></image>
				<view class="item_label">专&nbsp;&nbsp;&nbsp;业</view>
					<view class="item_value">{{class_name}}</view>
			</view>
			
			<!-- <view class="item_info zhengwen1">
				<image src="../../../static/tel@2x.png"></image>
				<view class="item_label">手机号</view>
				<view class="item_value">{{tel}}</view>
			</view>
			<view class="item_info zhengwen1">
				<image src="../../../static/id@2x.png"></image>
				<view class="item_label">身份证</view>
				<view class="item_value">{{idcard}}</view>
			</view> -->
			
			<view class="item_info zhengwen1">
				<image src="../../../static/tea@2x.png"></image>
				<view class="item_label">辅导员</view>
				<view class="item_value">{{fdy}}</view>
			</view>
			
			<view class="item_info zhengwen1">
				<image src="../../../static/psw@2x.png"></image>
				<view class="item_label">账号密码</view>
				<view class="item_value">{{password}}</view>
			</view>
			
			<!-- <view class="item_info zhengwen1">
				<view class="item_label">专业：</view>
				<view class="item_value">计算机应用</view>
			</view> -->
		</view>
		
		<!-- <button class="common-btn" style="width: 572rpx;">更新数据</button> -->
		<button class="common-btn" style="width: 572rpx;" @click="logout">退出</button>
	</view>



</template>

<script>
	export default {
		data() {
			return {
                name:"",
				sno:"",
				tel:"",
				idcard:"",
				password:"",
				colname:"",
				class_name:"",
				fdy:"",
			}
		},
		onLoad(options) {
			// console.log("satoken:"+uni.getStorageSync('satoken'));
			uni.request({
			   // url:"/api/leave/getUserInfo",
			   url:this.baseUrl+ "/leave/getUserInfo?satoken="+uni.getStorageSync('satoken'),
			   method:'GET',				    
			   headers: {
			    // "token": localStorage.getItem("token")
					"content-type": "application/x-www-form-urlencoded",
			    // "satoken": uni.getStorageSync('satoken')
			    },
			   success: (res) => {
					console.info(res.data.result); 
					this.name=res.data.result.name;
					this.sno=res.data.result.sno;
					this.tel=res.data.result.tel;
					this.idcard=res.data.result.idcard;
					this.password=res.data.result.password;
					this.colname=res.data.result.colname;
					this.class_name=res.data.result.class_name;
					this.fdy=res.data.result.fdy;
			    }
			});
			
		},
		methods: {
			logout(){
				uni.request({
					url:this.baseUrl+ "/mobile/logout?satoken="+uni.getStorageSync('satoken'),
					method:'GET',
					data: {
					
					},
					withCredentials:true,
					headers: {
					 },
					success:(res) => {
							//清空缓存
							uni.setStorageSync('satoken', "");
							uni.reLaunch({
								url:"/pages/login/login"
							})
					}
				});
			}
		}
	}
</script>

<style>
	@import url(@/common/common.css);

	.box_width {
		width: 95%;
		margin: 0 auto;
	}

	.top_info_box {
		height: 200rpx;
		padding-top: 20rpx;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		margin-bottom: 40rpx;
	}

	.top_info_img {
		width: 160rpx;
		height: 198rpx;
	}

	.top_info_img>image {
		width: 100%;
		height: 100%;
	}

	.info_left_box {
		flex: 1;
		padding-left: 30rpx;
		padding-top: 10rpx;
	}

	.info_left_height {
		height: 70rpx;
		line-height: 95rpx;
	}
	.my_con{ height: 240px; width:100%; }

	.item_info {
		width: 100%;
		line-height: 54rpx;
		margin: auto;
		/* text-align: justify; */
		/* text-align-last: justify; */
		margin-top: 20rpx;
	}
	.item_info image{width: 40rpx;height: 48rpx;margin:0 30rpx 0 10rpx;position: relative;top: 13rpx;}
	.item_label {width: 150rpx; display: inline-block; margin-right:60rpx;  }
	
		
	
	.item_value {
		display: inline-block;
	}

</style>
